//
//  UsedCarTableViewCell.m
//  Car
//
//  Created by lanou on 15/9/22.
//  Copyright (c) 2015年 朱鸿儒. All rights reserved.
//

#import "UsedCarTableViewCell.h"

@implementation UsedCarTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self) {
        self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.imaurl = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 88, 66)];
        self.imaurl.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:self.imaurl];
        self.name = [[UILabel alloc]initWithFrame:CGRectMake(93, 5, kWidth - 93, 40)];
        self.name.font = [UIFont systemFontOfSize:15];
        [self addSubview:self.name];
        self.name.numberOfLines = 2;
        self.buytime = [[UILabel alloc]initWithFrame:CGRectMake(95, 50, 200, 20)];
        self.buytime.font = [UIFont systemFontOfSize:15];
        [self addSubview:self.buytime];
        self.price = [[UILabel alloc]initWithFrame:CGRectMake(kWidth - 40,35 , 40, 16)];
        [self addSubview:self.price];
        self.price.font = [UIFont systemFontOfSize:10];
        self.price.textColor = [UIColor redColor];
        self.dealaddr = [[UILabel alloc]initWithFrame:CGRectMake(kWidth - 40,51 , 40, 16)];
        self.dealaddr.font = [UIFont systemFontOfSize:11];
        [self addSubview:self.dealaddr];
    }
    return self;
}
- (void)setWithModel:(UsedCarModel *)model{
    if ([Setting shareWithSetting].isOnPic == NO) {
    [self.imaurl sd_setImageWithURL:[NSURL URLWithString:model.imgurl]];
    }
    self.name.text = model.name;
    self.buytime.text = [NSString stringWithFormat:@"%@/%@",model.mileage,model.buytime];
    self.price.text = model.price;
    self.dealaddr.text = model.dealaddr;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
